<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<!--vue组件化: 可复用，充分利用了面向对象的特征-->
<!--自定义组件和组件之间的传值，父组件向子组件传值-->
<div id="app">
    <ul>
        <my-li v-for="name in names" v-bind:name="name">{{name}}</my-li>
    </ul>
</div>

<!-- 生产环境版本，优化了尺寸和速度 -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript">
    Vue.component("my-li",{
        props: ["name"],
        template: "<li style='color: red'>{{name}}</li>"
    })
    var vm = new Vue({
        el: "#app",
        data:{
            names: ["孙","彬","林","实时"]
        }
    })
</script>
</body>
</html>